<template>
  <MkBillList ref='drawerRef'>
      <MkQueryContainer>
          <template #header="">
              <MkForm ref="queryForm" :model="searchParam" :inline="true">
                  <MkInput label="关键字" @keyup.enter.native="search" v-model="searchParam.keyword" clearable="" />
                  <el-form-item>
                      <MkButtonQuery @click="search"> </MkButtonQuery>
                  </el-form-item>
              </MkForm>
          </template>
          <MkTable :data="tableData" v-loading="loading" @row-dblclick="edit">
              <MkColumnIndex />
              <MkColumn prop="id" label="单据号" />
              <MkColumn prop="danJuLeiXing" label="单据类型" />
              <MkColumn prop="danJuZhuangTai" label="单据状态" />
              <MkColumn prop="tuiXueYuanYin" label="退血原因" />
          </MkTable>
          <MkPagination v-model:page="searchParam.page" v-model:pageSize="searchParam.pageSize" :total="total"
              @query="search" />
      </MkQueryContainer>
  </MkBillList>
</template>

<script lang='ts' setup>
// 血液入库单
import { InvTuiXueApi, InvTuiXueOutput } from '/@/api/inv/InvTuiXue';
import { usePageQuery } from '/@/hooks/usePageQuery'
import { clog, showSuccess } from '/@/utils'

const drawerRef = ref();
const emits = defineEmits(['load'])
const { searchParam, total, tableData, loading, search } = usePageQuery<InvTuiXueOutput>(InvTuiXueApi.page)

onMounted(() => {
  search();
})

const edit = (row: any) => {
  drawerRef.value?.close();
  emits('load', row)
}

const open = async () => {
  drawerRef.value.show();
};

defineExpose({ open })

</script>

<style lang='scss' scoped></style>